<% html_title(t(:label_administration), t('recaptcha.label_recaptcha')) -%>

<%= breadcrumb_toolbar t('recaptcha.label_recaptcha') %>

<section class="admin--edit-section">
  <%= styled_form_tag({ action: :update },
                      method: :post,
                      id: 'update-recaptcha-settings-form') do %>
    <fieldset class="form--fieldset">
      <legend class="form--fieldset-legend"><%= t(:label_settings) %></legend>
      <div class="form--field">
        <label class="form--label" for='recaptcha_type'><%= t('recaptcha.settings.type') %></label>
        <div class="form--field-container">
          <%= styled_select_tag 'recaptcha_type',
                                options_for_select(recaptcha_available_options, Setting.plugin_openproject_recaptcha[:recaptcha_type]),
                                container_class: '-middle' %>
        </div>
        <div class="form--field-instructions">
          <%= I18n.t('recaptcha.settings.recaptcha_description_html',
                     recaptcha_link: link_to('https://www.google.com/recaptcha', 'https://www.google.com/recaptcha', target: '_blank')).html_safe %>
        </div>
      </div>
      <div class="form--field">
        <label class="form--label" for='website_key'><%= t('recaptcha.settings.website_key') %></label>
        <div class="form--field-container">
          <%= styled_text_field_tag 'website_key',
                                    Setting.plugin_openproject_recaptcha[:website_key] %>
        </div>
        <div class="form--field-instructions">
          <%= I18n.t('recaptcha.settings.website_key_text') %>
        </div>
      </div>
      <div class="form--field">
        <label class="form--label" for='secret_key'><%= t('recaptcha.settings.secret_key') %></label>
        <div class="form--field-container">
          <%= styled_text_field_tag 'secret_key',
                                    Setting.plugin_openproject_recaptcha[:secret_key] %>
        </div>
        <div class="form--field-instructions">
          <%= I18n.t('recaptcha.settings.secret_key_text') %>
        </div>
      </div>
    </fieldset>
    <%= styled_submit_tag l(:button_apply), class: '-highlight' %>
  <% end %>
</section>
